/*
 * Created: Author: Aléx Carvalho / Date: 1/mai/2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-12 03:38:01 +0000 (Fri, 12 Jun 2015) $
 */
package com.cpm.view.zk.applications;

import com.cpm.ServiceLocator;
import com.cpm.aggregate.SessionAttribute;
import com.cpm.entities.id.IntegerId;
import com.cpm.view.Icon;
import com.cpm.view.IconKit;
import com.cpm.view.zk.IconElement;
import com.cpm.view.zk.MenuAction;
import java.util.LinkedHashSet;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zul.Div;

public class HomeApplication extends AbstractApplication {

    private final Div div = new Div();

    public HomeApplication() {
        initComponents();
    }

    @Override
    protected void getMenuActions(LinkedHashSet<MenuAction> menuActions) {
    }

    @Override
    protected HtmlBasedComponent getComponentCenter() {
        return div;
    }

    @Override
    public String getLabel() {
        return "Home";
    }

    @Override
    public Icon getIcon() {
        return new Icon(IconKit.HOME);
    }

    @Override
    public Double getPosition() {
        return 1.0;
    }

    private void initComponents() {
        
        ServiceLocator.getSessionContext().putAttribute(SessionAttribute.STRATEGIC_PLAN, ServiceLocator.getStrategicPlanRepository().findById(new IntegerId(1)));
        
        Icon trash = new Icon(IconKit.DELETE);
        trash.putAttribute(() -> "  bottom: 0px; right: 0px; position: absolute; font-size: 50px;");
        
        IconElement element = new IconElement(trash);
        
        div.setHeight("100%");
        div.setWidth("100%");
        div.appendChild(element.getElement());
    }
}
